package com.cheng.chengliving.commodity.config;

import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;

/**
 * @Author: 朱程
 * @Date: 2022/11/24/15:53
 * @Description:
 */

@Configuration
@EnableTransactionManagement //开启事务
@MapperScan("com.cheng.chengliving.commodity.dao")
public class MyBatisConfig {

    //引入分页插件
    @Bean
    public PaginationInterceptor paginationInterceptor() {

        PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
        //溢出总页数,返回到第一页即可
        paginationInterceptor.setOverflow(true);
        //单页限制100条 <0比如-1则不受限制
        paginationInterceptor.setLimit(100);

        return paginationInterceptor;
    }
}
